Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@gasket/plugin-lifecycle
Advanced tools
Allows a gasket/ directory to be used for lifecycle hooks in applications.
Hook Gasket lifecycles using files in a lifecycles/
directory.
This is a default plugin in the Gasket CLI and is always available for use.
Create a lifecycles
folder in the root of your application. This folder should
contain files that can interact with the various of Gasket lifecycles that are
implemented by the plugins.
The name of the file (excluding the .js
extension) is used as the name of the
lifecycle event and the exported function of that file is used as handler of the
event. So you end up with the following application structure:
gasket.config.js
pages/
lifecycles/
express.js
middleware.js
webpack.js
In the example above we register to 3 different lifecycle hooks:
express
middleware
webpack
Each of these files export a function that is called when the lifecycle is
executed. For example, for middleware
the file could look like:
const cors = require('access-control');
/**
* Introduce new middleware layers to the stack.
*
* @param {Gasket} gasket Reference to the gasket instance
*/
module.exports = function middleware(gasket) {
return cors({
maxAge: '1 hour',
credentials: true,
origins: 'http://example.com'
});
};
It is recommended that you use kebab-case
or snake_case
naming conventions
for multi-word lifecycle events to avoid problems with case sensitivity in
different file systems. This plugin will automatically map these to the
camelCased
event names. For example, /lifecycles/app-env-config.js
will
properly hook appEnvConfig
events.
FAQs
Allows a gasket/ directory to be used for lifecycle hooks in applications.
We found that @gasket/plugin-lifecycle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.